package com.gomore.opple.data.remote.retrofit;

import com.gomore.opple.exception.ApiException;

import rx.Observer;

/**
 * Company 上海勾芒科技有限公司.
 */
public abstract class ErrorSubscriber<T> implements Observer<T> {
    @Override
    public void onError(Throwable e) {
        if (e instanceof ApiException) {
            onError((ApiException) e);
        } else {
            onError(new ApiException(e, 123));
        }
    }

    /**
     * 错误回调
     */
    protected abstract void onError(ApiException ex);
}